# 1 "syscall.c"
# 1 "/home/diego/sodium/kernel//"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "syscall.c"
# 1 "../include/video.h" 1
# 13 "../include/video.h"
# 1 "../include/kernel/definiciones.h" 1
# 14 "../include/kernel/definiciones.h"
# 1 "../include/usr/tipos.h" 1
# 15 "../include/usr/tipos.h"
typedef unsigned int dword;
typedef unsigned short word;
typedef unsigned char byte;

typedef unsigned char u8;
typedef signed char s8;
typedef unsigned short u16;
typedef signed short s16;
typedef unsigned int u32;
typedef signed int s32;


typedef struct _u80 { unsigned int word[20]; } u80;
# 15 "../include/kernel/definiciones.h" 2
# 62 "../include/kernel/definiciones.h"
char stArgAux[128];
# 14 "../include/video.h" 2
# 1 "../include/kernel/libk/string.h" 1
# 9 "../include/kernel/libk/string.h"
inline unsigned char* ucpFnCopiarMemoria(unsigned char *ucpDestino,
      unsigned char *ucpOrigen,
      unsigned int uiTamanio);
inline unsigned char* ucpFnMemSetCero(unsigned char *ucpDirInicio,
                  unsigned int uiTamanio );

int iFnLongitudCadena (const char *cnstCadena);
int iFnCompararCadenas (const char *, const char *);
int iFnCompararCadenas2 (const char *, const char *);
int iFnCopiaCaracter (char *, const char *);
int iFnCopiaCadena (char *, const char *);

int iFnCopiaEntero (char *, const int);
int iFnCopiaFloat (char *, const float, const int);
int iFnCopiaWord (char *, const word);
int iFnCopiaByte (char *, const byte);
int iFnCopiaHexa (char *, const int);
int iFnCopiaWordHexa (char *, const word);
int iFnCopiaByteHexa (char *, const byte);
void vFnImprimirString (char *, const char *, ...);
int iFnLongitudCadena (const char *);

int iFnCopiaCadena2 (char *, const char *);
char * pstFnConcatenarCadena (char * , char * );
int iFnBuscarEnCadena (char * , char * ,int );
char * pstFnCadenaIzquierda (char * , int );
char * pstFnCadenaDerecha (char * , int );
int iFnEsNumero (char * stCadena);

void vFnStrLwr (char * stCadena);
void vFnStrUpr (char * stCadena);
# 15 "../include/video.h" 2
# 58 "../include/video.h"
typedef char* va_list;
# 100 "../include/video.h"
int iFnImprimirCadenas (int,const char*);




void vFnImprimirEntero (int,const int);




void vFnImprimirFloat (int,const double, const int);




void vFnImprimirHexa (int,const int);




void vFnImprimirWordHexa (int,const word);




void vFnImprimirByteHexa (int,const byte);





void vFnImprimirWin (int,const char*, ... );
void vFnImprimir (const char*, ... );
void vFnImprimirI (const char*, ... );

extern char cFnSysObtenerColor(int);
extern void vFnSysSetearColor(int,char);
extern void vFnSysSetearX(int,int);
extern void vFnSysSetearY(int,int);
extern void vFnClsWin(int);





void vFnImprimirContextSwitch(int color,int pid, char* nombre, int indiceGDT);
void vFnImprimirPrompt();
void vFnImprimirOk(int linea);
void vFnImprimirNOk(int linea);

void vFnImprimirVentana (int hVentana, const char *cnstCadena, ...);






int bTerminalActiva;

void vFnCambiarTerminal(void);
void vFnLog (const char *cnstCadena, ...);

void vFnLogScrollArriba();
void vFnLogScrollAbajo();

void vFnLogScrollMaximo();
void vFnLogScrollMinimo();
void vFnLogBorrar();
# 2 "syscall.c" 2
# 1 "../include/kernel/gdt.h" 1







# 1 "../include/kernel/pcb.h" 1







# 1 "../include/kernel/shm.h" 1
# 18 "../include/kernel/shm.h"
typedef unsigned int size_t;
typedef int key_t;
typedef int bool;


typedef struct _stuMemoriasAtachadas_
{
 bool utilizada;
 int posicionEnShMem;
 int posicionEnAttach;
}stuMemoriasAtachadas;


typedef struct _attach_
{
 int pid;
 void * ptrShAddr;

}attach;


typedef struct _shMem_
{
 key_t key;
 unsigned long int tamanio;
 attach procAtt[5];
 bool declarada;
}shMem;

shMem memoriasCompartidas[5];




int iFnShmGet(key_t key, size_t size);


int iFnShmAt(int shmid, void * shmAddr);


int iFnShmDt(int shmid);

int iFnShmDtProc(int shmid, unsigned int uiPid);
int iFnShmDtAllProc(unsigned int uiPid);

unsigned long ulFnMaxDirShmProc(unsigned int uiPid);

void vFnInicializarShms();
void vFnVerShm();




void vFnCopiarVariablesCompartidas();



void vFnCopiarVariable(void * dest, void * src, size_t tamanio);
# 9 "../include/kernel/pcb.h" 2
# 1 "../include/kernel/tiempo.h" 1
# 53 "../include/kernel/tiempo.h"
typedef unsigned long int time_t;
typedef unsigned long int clock_t;





typedef struct{

        clock_t tms_utime;


        clock_t tms_stime;


        clock_t tms_cutime;


        clock_t tms_cstime;
} tms;





typedef struct{

        int tz_minuteswest;


        int tz_dsttime;
} timezone;





typedef struct{

        unsigned long int tv_sec;


        unsigned long int tv_usec;
} timeval;





typedef struct{

        timeval it_interval;


        timeval it_value;
} itimerval;





typedef struct{

        int modes;


 long offset;


 long freq;


 long maxerror;


 long esterror;


 int status;


 long constant;


 long precision;


 long tolerance;


 timeval time;


 long tick;
} timex;





typedef struct{

        long int tv_sec;


        long int tv_nsec;
} timespec;
# 10 "../include/kernel/pcb.h" 2
# 27 "../include/kernel/pcb.h"
typedef struct {
 unsigned char ident[16];
 unsigned short type;
 unsigned short machine;
 unsigned int version;
 unsigned int entry;
 unsigned int phoff;
 unsigned int sphoff;
 unsigned int flags;
 unsigned short ehsize;
 unsigned short phentsize;
 unsigned short phnum;
 unsigned short shentsize;
 unsigned short shnum;
 unsigned short shstrndx;
} elfHeader;

typedef struct {
 unsigned int name;
 unsigned int type;
 unsigned int flags;
 unsigned int addr;
 unsigned int offset;
 unsigned int size;
 unsigned int link;
 unsigned int info;
 unsigned int addralign;
 unsigned int entsize;
}SHeader;

typedef struct {
        unsigned int type;
 unsigned int offset;
 unsigned int vaddr;
        unsigned int paddr;
        unsigned int filesz;
        unsigned int memsz;
        unsigned int flags;
        unsigned int align;
} PHeader;






typedef struct {
   elfHeader elfHeaderData;
   SHeader SHeaderData;
   PHeader PHeaderData;
   unsigned char ucbuffer[4];
} stuHeaderELF;





typedef struct {
   int iEstado;
   long int liTamanio;
} stuEsperarMemoria;
# 96 "../include/kernel/pcb.h"
typedef struct _stuPCB_{
  unsigned long int ulId;
  unsigned int uiIndiceGDT_CS;
  unsigned int uiIndiceGDT_DS;
  unsigned int uiIndiceGDT_TSS;
  unsigned int uiIndiceGDT_SS0;
  void (* vFnFuncion) ();

  unsigned long ulParentId;
  unsigned long ulUsuarioId;
  int iPrioridad;
  int iEstado;
  unsigned long lNHijos;
  int iExitStatus;
  unsigned long ulLugarTSS;
  char stNombre[25];
  unsigned int uiTamProc;
  struct stuTablaPagina * pstuTablaPaginacion;
  unsigned int uiDirBase,

        uiLimite;
  stuMemoriasAtachadas memoriasAtachadas[5];


  unsigned long ulTiempoEspera;
  unsigned long ulTiempoServicio;



  struct stuPCB* pstuPcbSiguiente;

  tms stuTmsTiemposProceso;

  itimerval timers[3];

  long lNanosleep;

  unsigned int *puRestoDelNanosleep;

    long lPidTracer;

    unsigned int uiTamanioTexto;
    unsigned int uiTamanioDatosInicializados;
    unsigned int uiTamanioStack;

    unsigned int uiTamanioOverhead;

    unsigned int uiEsperaTeclado;

    stuHeaderELF stuCabeceraELF;
    int iModoParticion;
    stuEsperarMemoria stuEsperaMemoria;
    unsigned int uiBaseSs0;
}stuPCB;
# 9 "../include/kernel/gdt.h" 2
# 32 "../include/kernel/gdt.h"
stuPCB pstuPCB[50];

int iCOLA_FLOPPY_ES[50];

unsigned int uiCOLA_FLOPPY_ES_INDEX_INI;
unsigned int uiCOLA_FLOPPY_ES_INDEX_FIN;
unsigned int uiPROC_FLOPPY;
unsigned int uiFIN_FLOPPY;
unsigned int uiCiclo;

unsigned int uiTamHeap;
# 63 "../include/kernel/gdt.h"
typedef struct {
  unsigned short usLimiteBajo;
  unsigned short usBaseBajo;
  unsigned char ucBaseMedio;







 unsigned char ucAcesso;

  unsigned int bitLimiteAlto:4;
# 89 "../include/kernel/gdt.h"
 unsigned int bitGranularidad:4;

  unsigned char usBaseAlto;

} __attribute__((packed)) stuGDTDescriptor;






typedef struct {
   stuGDTDescriptor stuGdtDescriptorDescs[8192];
} stuEstructuraGdt;



stuEstructuraGdt *pstuTablaGdt;






typedef struct {
  unsigned int control;
  unsigned int status;
  unsigned int tag;
  unsigned int ip;
  unsigned int cs;
  unsigned int dp;
  unsigned int ds;
  u80 st[8];
} __attribute__((packed)) stuFpu;
# 131 "../include/kernel/gdt.h"
typedef struct {
  unsigned int uiEnlace;
  unsigned int esp0;
  unsigned int ss0;
  unsigned int esp1;
  unsigned int ss1;
  unsigned int esp2;
  unsigned int ss2;
  unsigned int cr3;
  unsigned int eip;
  unsigned int uiEBandera;
  unsigned int eax;
  unsigned int ecx;
  unsigned int edx;
  unsigned int ebx;
  unsigned int esp;
  unsigned int ebp;
  unsigned int esi;
  unsigned int edi;
  unsigned int es;
  unsigned int cs;
  unsigned int ss;
  unsigned int ds;
  unsigned int fs;
  unsigned int gs;
  unsigned int ldt;
  unsigned int trapbit;
  unsigned int uIOMapeoBase;
  char espacio0[1024];
  char espacio1[16];
  char espacio2[16];
  stuFpu fpu;
}stuTSS;


typedef struct {
    void * pvPuntoCarga;
    unsigned int uiTamanioTexto;
    unsigned int uiTamanioDatosInicializados;
    unsigned int uiTamanioStack;
    char stNombre [13];
} stuInfoEjecutable;







stuPCB pstuPCB[50];
stuTSS stuTSSTablaTareas[50];





typedef struct {
   char stBinario[30];
   long int liTamanio;
} stuListaEspera;


int iCantEnEspera;
stuListaEspera stListaEspera[100];
void vFnGdtInicializar(dword);

int iFnBuscaPosicionProc(unsigned long);
unsigned int uiFnSetearBaseLimiteDescriptor(int,unsigned int,unsigned int);

unsigned int iFnAgregarDescriptorGDT(unsigned int,unsigned int,unsigned int,int);

int iFnBuscarPCBLibre();
unsigned int uiFnBuscarEntradaGDTLibre();

void vFnRecorrerListaEspera();
int iFnCrearTSSReloj (void*,int,unsigned int,unsigned int,unsigned int);
int iFnCrearTSS (void*,void*,int,unsigned int,unsigned int,unsigned int,unsigned int,unsigned int,int);

int iFnCrearPCB(int,void*,char*,unsigned int,unsigned int,unsigned int,unsigned int,unsigned int,unsigned int,unsigned int,unsigned int, unsigned int, unsigned int,unsigned int);

int iFnInstanciarReloj(void *, char*);
int iFnInstanciarIdle();
int iFnInstanciarInit();

void vFnAgregarListaEspera(char*, long int);

int iFnLeerCabeceraEjecutable(char* stArchivo, stuInfoEjecutable* pstuInfo);

int iFnCrearProceso(char *,int,int);
int iFnCrearCallGate(int, unsigned short, unsigned short, unsigned char, unsigned int, unsigned int, unsigned short);
int iFnRedimensionarProceso(unsigned long ulPid, unsigned long ulBrk);

int iFnDuplicarProceso(unsigned int uiProcPadre);
int iFnEliminarProceso(unsigned int uiProcesp);
int iFnReemplazarProcesoFija( unsigned int uiProceso, unsigned char *__codigo, unsigned int size );
int iFnReemplazarProceso(unsigned long, char *, unsigned int);






char* pstFnObtenerEnviroment();


int iFnClonarProceso();
# 3 "syscall.c" 2
# 1 "../include/kernel/syscall.h" 1







# 1 "../include/kernel/signal.h" 1
# 9 "../include/kernel/syscall.h" 2
# 1 "../include/kernel/semaforo.h" 1
# 20 "../include/kernel/semaforo.h"
typedef struct
{
 int inicializado;
 int valor;
 unsigned long int head;
 unsigned long int tail;

 unsigned long int procesosEnCola;

 unsigned long int cola[5];
 unsigned long int pshared;
}semaforo;





typedef struct
{
 int sem_id;
}sem_t;





typedef struct{
 int pshared;
 unsigned int value;
} sem_init_params;


void vFnEncolarProceso(semaforo *sem, unsigned long int uliId);


void vFnInicializaCola(unsigned long int *cola);


int iFnHayProcesoEnEspera(semaforo *sem);


unsigned long int uliFnDesencolarProceso(semaforo *sem);


void vFnInicializarSemaforos();
# 77 "../include/kernel/semaforo.h"
int iFnSemInit(sem_t *sem, int pshared, unsigned int value);
# 86 "../include/kernel/semaforo.h"
int iFnSemClose(sem_t *sem);
# 106 "../include/kernel/semaforo.h"
int iFnSemWait(sem_t *sem);
# 116 "../include/kernel/semaforo.h"
int iFnSemPost(sem_t *sem);

int validaExistenciaSemaforo(sem_t *sem);


int agregarSemaforoAlSistema(int pshared, unsigned int value);

void vFnVerSemaforos();
# 10 "../include/kernel/syscall.h" 2
# 195 "../include/kernel/syscall.h"
enum __ptrace_request {
 PTRACE_TRACEME,
 PTRACE_PEEKTEXT,
 PTRACE_PEEKDATA,
 PTRACE_PEEKUSER,
 PTRACE_POKETEXT,
 PTRACE_POKEDATA,
 PTRACE_POKEUSER,
 PTRACE_GETREGS,
 PTRACE_GETFPREGS,
 PTRACE_SETREGS,
 PTRACE_SETFPREGS,
 PTRACE_CONT,
 PTRACE_KILL,
 PTRACE_ATTACH,
 PTRACE_DETACH
};


typedef struct {
 int iPid;
 void *pvAddr;
 void *pvData;
}__ptrace_param;



typedef struct _stuRegs_
{
  long ebx;
  long ecx;
  long edx;
  long esi;
  long edi;
  long ebp;
  long eax;
  int xds;
  int xes;
  long orig_eax;
  long eip;
  int xcs;
  long eflags;
  long esp;
  int xss;
} stuRegs;






long lFnSysExit( int status );
long lFnSysFork();
long lFnSysTest( long num );
long lFnSysRead( int, void *buf, size_t count );
long lFnSysWrite( int, const void *buf, size_t count );
long lFnSysWaitPid( int pid, int *status, int options );
long lFnSysExecve( const char *filename, char *argv[], char *envp[] );
long lFnSysTime( long *t );
long lFnSysGetPid();
long lFnSysKill( int pid, int sig );
long lFnSysGetPPid();
long lFnSysReboot( int flag );
long lFnSysSodiumCallgate(int iOpcion, int iPar1, int iPar2);
long lFnSysBrk(unsigned long);
long lFnSysSBrk(unsigned long);
long lFnSysSemInit( sem_t *sem, sem_init_params * params);
long lFnSysSemPost( sem_t *sem );
long lFnSysSemWait( sem_t *sem );
long lFnSysSemClose( sem_t *sem );
long lFnSysShmGet( key_t key, size_t size );
long lFnSysShmAt( int shmid, void * shmAddr );
long lFnSysShmDt( key_t key );

int iFnSysSumar(int a, int b, int * res);



long lFnSysNice( int );
long lFnSysGetpriority( int, int );
long lFnSysSetpriority( int, int, int );
long lFnSysClone(stuRegs *,int flags);


long lFnSysIdle();



long lFnSysSchedSetParam(int p);
long lFnSysSchedGetParam();
long lFnSysSchedSetScheduler(int p);
long lFnSysSchedGetScheduler();
long lFnSysSchedYield();
long lFnSysSchedGetPriorityMax();
long lFnSysSchedGetPriorityMin();
long lFnSysSchedRrGetInterval();





long lFnSysStime(time_t *newtime);
long lFnSysTimes(tms *ptmsbuffer);
long lFnSysGettimeofday(timeval *ptimervalTp, timezone *ptimezoneTzp);
long lFnSysSettimeofday(timeval *ptimevalTp, timezone *ptimezoneTzp);
long lFnSysGettimer(int iWhich, itimerval *pitimervalValue);
long lFnSysSettimer(int iWhich, itimerval const *pcnitimervalValue, itimerval *ptimervalOvalue);
long lFnSysAdjtimex(timex *ptimexBuffer);
long lFnSysNanosleep(timespec const *pcntimespecRequested_time, timespec *ptimespecRemaining);



long lFnSysPtrace( int request, void *pvDirParam );





unsigned long ulFnSysBrk(unsigned long brk);
# 4 "syscall.c" 2
# 1 "../include/kernel/system.h" 1
# 22 "../include/kernel/system.h"
unsigned long int uliClockTick;





typedef struct
{
    unsigned int :16;
    unsigned int TSSSegmentSelector :16;
    unsigned int :8 ;
    unsigned int Type :5;
    unsigned int DPL :2;
    unsigned int P :1;
    unsigned int :16;
} __attribute__((packed)) t_TaskGate;





typedef struct
{
    unsigned int Offset1 :16;
    unsigned int SegmentSelector :16;
    unsigned int :5 ;
    unsigned int Type :8;
    unsigned int DPL :2;
    unsigned int P :1;
    unsigned int Offset2 :16;
} __attribute__((packed)) t_InterruptGate;




typedef struct
{
    unsigned int Offset1 :16;
    unsigned int SegmentSelector :16;
    unsigned int :5 ;
    unsigned int Type :8;
    unsigned int DPL :2;
    unsigned int P :1;
    unsigned int Offset2 :16;
} __attribute__((packed)) t_TrapGate;




typedef union
{
    t_TaskGate TaskGate;
    t_InterruptGate InterruptGate;
    t_TrapGate TrapGate;
}stuIDTDescriptor;




typedef struct
{
    stuIDTDescriptor IDTDescriptor[256];
} stuIDT;


typedef struct
{
    dword dwLimite :16;
    dword dwBase :32;
} t_IDTRegister;

stuIDT *pstuIDT;
unsigned char ucFnObtenerScanCode();
void vFnIniciarTeclado();
void vFnIniciarExcepciones();
void vFnIniciarIDT();
void vFnHandlerGenerico();
void vFnHandlerTimer();
void vFnPlanificador();
void vFnHandlerTeclado();
void* pvFnKernelStackAdmin();


void vFnHandlerDisquette();

long vFnHandlerSyscall( long eax,
   long ebx,
   long ecx,
   long edx );

void vFnLTR(unsigned int uiSelector);
unsigned int uiFnSTR(void);
# 5 "syscall.c" 2
# 1 "../include/kernel/sched.h" 1
# 15 "../include/kernel/sched.h"
typedef struct
{
 int sched_priority;
}sched_param;


unsigned long int uliTimeSlice;


unsigned long int uliQuantum;

unsigned long int uliBTSQ;


static int staiN = 0;

static int staiProcesoAnterior = -1;


int iTareaNula;

void vFnPlanificadorFIFO();
void vFnPlanificadorRR();
void vFnPlanificadorBTS();
# 6 "syscall.c" 2
# 1 "../include/kernel/puertos.h" 1
# 26 "../include/kernel/puertos.h"
byte inb(word);
# 38 "../include/kernel/puertos.h"
word inw(word);
# 50 "../include/kernel/puertos.h"
void outb(const byte valor, const word puerto);
# 61 "../include/kernel/puertos.h"
void outw(const word valor, const word puerto);
# 7 "syscall.c" 2

# 1 "../include/shell/teclado.h" 1
# 509 "../include/shell/teclado.h"
char stBufferShell[256];

char stBufferTeclado[10];






struct _stuKeyCode {
    unsigned char tipo;
    unsigned char ascii;
};

typedef struct _stuKeyCode stuKeyCode;




struct _stuDefinicionTeclado {
    char sCodigo [5];
    char sNombre [25];
    stuKeyCode stashMatrizNormal [128];
    stuKeyCode stashMatrizShifted [128];
    stuKeyCode stashMatrizAltGred [128];
} __attribute__((packed));

typedef struct _stuDefinicionTeclado stuDefinicionTeclado;


void vFnManejadorTecladoShell (unsigned char ucScanCode);
void vFnScanCodeAKeyCode( stuKeyCode*, unsigned char );
void vFnScanCodeExtAKeyCode( stuKeyCode*, unsigned char );
void vFnKeyCodeNumPad( stuKeyCode* );
int iFnTeclaEspecial ( stuKeyCode, unsigned char );
int iFnCombinacionTeclasEspecial( stuKeyCode );
void * pvFnAbrirArchivoKeymap (void);
int iFnCambiaTecladoI(unsigned int);
int iFnCambiaTecladoS(char *);
void vFnListarKeymaps();
char cFnGetChar();
char cFnPausa();

int iCantidadCaracteres;
int iSemaforoBufferTeclado;
int iLlenarIndice;
static int staiVaciarIndice;
# 9 "syscall.c" 2
# 1 "../include/shell/shell.h" 1
# 13 "../include/shell/shell.h"
void vFnManejadorTecladoShell(unsigned char scanCode);

char cFnGetch();
char cFnPausa();
int iFnGetArg(int iPos, int iNumero, char* stResultado, int iAnchoMaximo);
int iFnXtoI (char *c);
int iFnHtoI (char *c);

void vFnAPM_info();
void vFnAPM_shutdown();

void vFnLoopReloj();
void vFnImprimirMenu ();
void vFnImprimirContexto();
void vFnMenuInstanciarInit();
void vFnMostrarListaParticiones();
void vFnBorrarUltimaPartFija();
void vFnAgregarPartFija(char*);
void vFnResetearListaPart();
int iFnShellActivo();


void vFnImprimirMenu ();
void vFnImprimirSeparadores ();




void vFnShell ();
void vFnMenuAyuda ();



void vFnMenuDump (int,int);
void vFnMenuWriteArch(int,int);
void vFnMenuOptKill(int);
void iFnTomaPrimerPara();
void iFnTomaNParametro(int,char *);
void vFnConvierteACadena(int, char *);



void vFnMenuKill (int);
void vFnMenuKillSeg (int);
void vFnMenuMem ();
void vFnMenuVer ();
void vFnMenuDesc (int,int);
void vFnMenuEjecutar(int);
void vFnMenuStack (int,int);
void vFnMenuGdt ();
void vFnMenuIdt ();
void vFnMenuCambiaTeclado (int);
void vFnMenuCls ();
void vFnMenuTSS (int);
void vFnMenuBitmap ();
void vFnMenuSegs ();
void vFnMenuPag (int);
void vFnMenuPs ();
void vFnMenuExec (int,int);
void vFnMenuExecSeg (int,int);
void vFnMenuLeerArch(int);
void vFnMenuCheck (int);
void vFnMenuSet (int);
void vFnSumaFpu (int);
void vFnMenuSumaFpu(int,int);
void vFnMenuVerSemaforos();
void vFnMenuVerShm();
void vFnMenuTestptrace(int);
void vFnMenuFd ();
void vFnMenuLs (int);
void vFnMenuCD(int);
void vFnMenuRm(int);

void vFnTermLog (unsigned char ucCaracter);

char *cpFnGetEnv(char *cpVariable);
void vFnGetAllEnv();
void vFnSetEnv(char *cpVariable, char *cpValor);
void vFnUnSetEnv(char *cpVariable);



typedef struct {
 char cpVariable[32 +1];
 char cpValor[32 +1];
 int iActiva;
}stuENV;




void vFnInicializarEnv();

stuENV pstuENV[10];


unsigned long ulPidProcesoForeground;
unsigned long uiAPM_ok;
unsigned long uiAPM_check_ax;
unsigned long uiAPM_check_bx;
unsigned long uiAPM_check_cx;

unsigned long uiAPM_32_cs;
unsigned long uiAPM_offset_entry_point;
unsigned long uiAPM_16_cs;
unsigned long uiAPM_ds;
# 10 "syscall.c" 2

# 1 "../include/fs/ramfs.h" 1
# 30 "../include/fs/ramfs.h"
typedef struct {
 char strNombreArchivo[11];
 word wSeg;
 word wOff;
 dword dwTamanio;
} __attribute__((packed)) stEntradaLS;




typedef struct {
 stEntradaLS stEnt[20];
} __attribute__((packed)) stDirectorio;




typedef struct {
 char strEtiqueta[20];
 char strPMontaje[44];
 dword dwDireccionInicial;
 dword dwTamanio;
 stDirectorio *pstDirRaiz;
 dword dwEntradasRaiz;
 u8 bActivo;
} stDiscoRAM;

int iFnRamFsInit(void);

int iFnNormalizarNomArch(const char *strNomArch83, char *strNomArch);

int iFnBuscarArchivo(stDirectorio * pstDir, char *strNombreArchivo, stEntradaLS ** ppstEntradaLSArchEnc);

int iFnObtenerDirectorio(char *strPMontaje, stDirectorio ** ppstDir);

int iFnObtenerDisco(char *strPMontaje, stDiscoRAM **ppstDisco);

int iFnRamFsLs(char *strParams);
# 12 "syscall.c" 2
# 1 "../include/kernel/mem/mem_part_firstfit.h" 1
# 22 "../include/kernel/mem/mem_part_firstfit.h"
typedef struct {
        int piPorcentajesPartFija[100];
} t_Porcentaje;

typedef struct {
 int iUsado;
 long int liTam;
} t_Nodo;



void* ptrHeap;
t_Nodo* ptrActual;
long int liHeapEnd;
int iModo;
int iKernel;
int iModoFijo;

long int piDistribucionPartFija[100];
long int piPorcentajesPartFija[100];

long int liTamanioLiberado;
long int liTamHeap;
long int liTamFija;
long int liTamHeapFijoVariable;

void vFnCrearNodo(long int, int, long int);
int iInicializar();
void* pvFnMalloc(long int);
void* pvFnRealloc(long int, unsigned long);
int iFnFree(long int);
# 13 "syscall.c" 2
# 1 "../include/kernel/mem/mem_part_kernel.h" 1



void* ptrHeapBajoKernel;
long int liTamanioHeapBajoKernel;

void* ptrHeapAltoUsuario;
long int liTamanioHeapAltoUsuario;


long int liTamFijaMemBaja;
long int liTamFijaMemAlta;
long int liTamanioSolicitado;

int iModoMemoriaKernel;
char stTamanioMemFija[20];
int iTamanioMemFijaSeteado;
int iPosicionSetMemFija;
int iContinuar;
int iModoFijoUser;

void vFnInicializarHeapsKernel();
void vFnConfigurarParticiones();

void * pvFnReservarParticionUsuario(unsigned int);
void * pvFnReservarParticionKernel(unsigned int);
void * pvFnRedimensionarSegmento(void*, unsigned long);
void vFnLiberarParticion( void * );
unsigned int uiHeapKernelInicializado;
unsigned int uiKernelStack;
# 14 "syscall.c" 2
# 1 "../include/kernel/mem/paginas.h" 1
# 13 "../include/kernel/mem/paginas.h"
struct stuTablaPagina{
  unsigned int uiFrame;
  unsigned int bUsado;
  };





struct stuBitMap {
  unsigned bit0: 1,
    bit1: 1,
    bit2: 1,
    bit3: 1,
    bit4: 1,
    bit5: 1,
    bit6: 1,
    bit7: 1;
  }__attribute__((packed));


int iTamanioMemoria;
int iLimCantPaginasProceso;


struct stuTablaPagina* pstuTablaPaginaFnAsignarPaginas (unsigned int);

void vFnIniciarMapaBits(int , int);




int iFnBuscarVacio();




int iFnVerificarSuficientes(int);

void vFnLimpiarFrame(int);




int iFnLimpiarMemoria(int, struct stuTablaPagina *);

void vFnImprimirTablaPaginas(int, struct stuTablaPagina *);

void vFnImprimirMapaBits();

int iFnDarDireccion( struct stuTablaPagina *, int, int, int);
# 15 "syscall.c" 2


extern stuPCB pstuPCB[50];
extern stuTSS stuTSSTablaTareas[50];
extern unsigned long ulProcActual;
extern unsigned long ulUltimoProcesoEnFPU;
extern short int bPlanificador;

extern unsigned long uliQuantum;
extern unsigned long uliBTSQ;

extern unsigned int uiModoMemoria;


extern unsigned long ulTiempo;

extern int iMinuteswest;

extern unsigned int iMilisegundosPorTick;

extern long lRelojOffset;

extern long lRelojFrequencia;

extern long lRelojMaxerror;

extern long lRelojEsterror;

extern long lRelojConstante;

extern int iRelojEstado;

extern void vFnIniciarTimer_Asm(int divisor);
# 72 "syscall.c"
long lFnSysExit(int status)
{
 int iPCBPadre =
     iFnBuscaPosicionProc(pstuPCB[ulProcActual].ulParentId);




 pstuPCB[ulProcActual].iEstado = 5;
 pstuPCB[ulProcActual].iExitStatus = status;





 if (pstuPCB[iPCBPadre].iEstado == 2) {



  pstuPCB[iPCBPadre].iEstado = 1;
 }



 vFnPlanificador();

 return 0;
}






long lFnSysFork()
{

 int ret = iFnDuplicarProceso(ulProcActual);


 if (ret < 0)
          {
                if (pstuPCB[iFnBuscaPosicionProc(ulProcActual)].stuEsperaMemoria.iEstado != 2) vFnImprimir("\nSuspendido %d a la espera de que se liberen %d Bytes tras intentar FORK...",ulProcActual,liTamanioSolicitado);
  pstuPCB[iFnBuscaPosicionProc(ulProcActual)].stuEsperaMemoria.iEstado = 2;
  pstuPCB[iFnBuscaPosicionProc(ulProcActual)].stuEsperaMemoria.liTamanio = liTamanioSolicitado;
  pstuPCB[iFnBuscaPosicionProc(ulProcActual)].iEstado = 2;
                return 1;
          }



 return pstuPCB[ret].ulId;
}






long lFnSysTest(long num)
{
   vFnImprimir("%d", num);
 return 0;
}







long lFnSysRead(int fd, void *buf, size_t count)
{
 unsigned int uiBase;
 unsigned char *pstPuntero;

        int cCaracter;





    if (staiVaciarIndice == iLlenarIndice)
       {
        pstuPCB[iFnBuscaPosicionProc(ulProcActual)].uiEsperaTeclado = 1;
        pstuPCB[iFnBuscaPosicionProc(ulProcActual)].iEstado = 2;
        return -1;
       }



    while (iSemaforoBufferTeclado != 0);
    iSemaforoBufferTeclado = 1;

    cCaracter = stBufferTeclado[staiVaciarIndice++];



    if (staiVaciarIndice > (10 - 1))
    {
        staiVaciarIndice = 0;

    }


    iSemaforoBufferTeclado = 0;




        if (!fd)
          {
          pstPuntero = (unsigned char *) (pstuPCB[ulProcActual].uiDirBase + (unsigned int) buf);
          *pstPuntero = cCaracter;
          }
 else
          {
            uiBase = pstuTablaGdt->stuGdtDescriptorDescs[fd].usBaseBajo;
     uiBase += pstuTablaGdt->stuGdtDescriptorDescs[fd].ucBaseMedio * 0x10000;
     uiBase += pstuTablaGdt->stuGdtDescriptorDescs[fd].usBaseAlto * 0x1000000;
            pstPuntero = (unsigned char *) (uiBase + (unsigned int) buf);
            *pstPuntero = cCaracter;
          }

         if((unsigned int)cCaracter == -6) cCaracter = 250;
         if((unsigned int)cCaracter == -5) cCaracter = 251;
         if((unsigned int)cCaracter == -4) cCaracter = 252;
         if((unsigned int)cCaracter == -3) cCaracter = 253;

 return cCaracter;
}






long lFnSysWrite(int iVentana, const void *buf, size_t count)
{
        if(iFnCompararCadenas(pstuPCB[ulProcActual].stNombre,"SHELLUSR.BIN") == 1 || iVentana == 0) vFnImprimir("%s", (unsigned char *) (pstuPCB[ulProcActual].uiDirBase + (unsigned int) buf));
        else vFnImprimirVentana (3, "%s", (unsigned char *) (pstuPCB[ulProcActual].uiDirBase + (unsigned int) buf));
 return 0;


}
# 225 "syscall.c"
long lFnSysWaitPid(int pid, int *status, int options)
{
 int iPCBHijo = iFnBuscaPosicionProc(pid);



 if (iPCBHijo < 0) {
  return -4;
 }



 while (pstuPCB[iPCBHijo].iEstado != 5) {

  pstuPCB[ulProcActual].iEstado = 2;



  vFnPlanificador();

 }
# 259 "syscall.c"
 *(int *) (pstuPCB[ulProcActual].uiDirBase +
    (unsigned char *) status) =
     pstuPCB[iPCBHijo].iExitStatus;


 iFnEliminarProceso(iPCBHijo);

 return pid;
}
# 276 "syscall.c"
long lFnSysExecve(const char *filename, char *argv[], char *envp[])
{
    int iReturnCode;
 int i,j,k;
 int iArgvSize, iEnvpSize;
 int iArgc, iEnvArgc;

 int *piVectorEnviroment;
 int *piVectorArgv;

 unsigned int uiOffset;
 unsigned int uiOffsetTemp;

 stEntradaLS *pstEntLs;
 stDirectorio *pstDirBusqueda;

 char* strNombreArchivo =(char*)((unsigned int)pstuPCB[ulProcActual].uiDirBase + (unsigned int)filename);
    char* stArgvTemp, *stEnvpTemp;

    char** pstArgvPointers, **pstEnvpPointers;


 if (iFnObtenerDirectorio("/mnt/usr", &pstDirBusqueda) < 0) {
  vFnImprimir
      ("\nSodium Dice: Error! El directorio no existe");
  return -10;
 }

 if (iFnBuscarArchivo(pstDirBusqueda, strNombreArchivo, &pstEntLs) < 0) {
  vFnImprimir
      ("\nSodium Dice: Error! Archivo no encontrado (%s)",
       strNombreArchivo);
  return -10;
 }
# 318 "syscall.c"
    uiOffset = 0;


   envp = (int)envp + pstuPCB[ulProcActual].uiDirBase;
   iEnvArgc = 0;

   while(envp[iEnvArgc] != 0 ) {
   envp[iEnvArgc] = (int)envp[iEnvArgc] + pstuPCB[ulProcActual].uiDirBase; iEnvArgc++;
   }

  iEnvpSize = 0;
  for(i=0; i < iEnvArgc; i++)
    {
   j = 0;
   while(envp[i][j] != '\0') j++;
   iEnvpSize = iEnvpSize + j +1 ;
    }



  stEnvpTemp = (char*)pvFnReservarParticionUsuario(iEnvpSize * sizeof(char));
  pstEnvpPointers = (char**)pvFnReservarParticionUsuario(iEnvArgc * sizeof(char*));




  k = 0;
  for(i=0; i < iEnvArgc; i++)
    {
   j = 0;
   while(envp[i][j] != '\0')
     {
    stEnvpTemp[k] = envp[i][j];
    j++;
    k++;
     }
   stEnvpTemp[k] = '\0';
   k++;
    }

  stEnvpTemp[iEnvpSize-1] = '\0';


  j = 0;
  for(i = 0; i < iEnvpSize; i++)
    {
   if(i == 0) { pstEnvpPointers[0] = 0; j++; }
   else if (stEnvpTemp[i-1] == '\n') { pstEnvpPointers[j] = i; j++;}
    }





  argv = (int)argv + pstuPCB[ulProcActual].uiDirBase;
  iArgc=0;

  while(argv[iArgc] != 0 ) {
    argv[iArgc] = (int)argv[iArgc] + pstuPCB[ulProcActual].uiDirBase; iArgc++;
    }


  iArgvSize = 0;
  for(i=0; i < iArgc; i++)
    {
   j = 0;
   while(argv[i][j] != '\0') j++;
   iArgvSize = iArgvSize + j +1 ;
    }


  stArgvTemp = (char*)pvFnReservarParticionUsuario(iArgvSize * sizeof(char));
  pstArgvPointers = (char**)pvFnReservarParticionUsuario(iArgc * sizeof(char*));




  k = 0;
  for(i=0; i < iArgc; i++)
    {
   j = 0;
   while(argv[i][j] != '\0')
     {
    stArgvTemp[k] = argv[i][j];
    j++;
    k++;
     }
   stArgvTemp[k] = '\0';
   k++;
    }


  j = 0;
  for(i = 0; i < iArgvSize; i++)
    {
   if(i == 0) { pstArgvPointers[0] = 0; j++; }
   else if (stArgvTemp[i-1] == '\0') { pstArgvPointers[j] = i; j++;}
    }



  uiOffset = uiOffset + sizeof(int);
  uiOffset = uiOffset + sizeof(char*);
  uiOffset = uiOffset + sizeof(char*);
  uiOffset = uiOffset + sizeof(char**);
  uiOffset = uiOffset + sizeof(char**);
  uiOffset = uiOffset + iEnvpSize;
  uiOffset = uiOffset + iArgvSize;
  uiOffset = uiOffset + (iArgc+1) * sizeof(int) ;
  uiOffset = uiOffset + (iEnvArgc+1) * sizeof(int) ;
  uiOffset = uiOffset + sizeof(int) ;





        iReturnCode = iFnReemplazarProceso( pstuPCB[ulProcActual].ulId, strNombreArchivo, uiOffset);


  if (iReturnCode < 0)
     {
       if (pstuPCB[iFnBuscaPosicionProc(pstuPCB[ulProcActual].ulId)].stuEsperaMemoria.iEstado != 1) vFnImprimir("\nSuspendido %d a la espera de que se liberen %d Bytes tras intentar EXEC...",ulProcActual,liTamanioSolicitado);
     pstuPCB[iFnBuscaPosicionProc(pstuPCB[ulProcActual].ulId)].stuEsperaMemoria.iEstado = 1;
     pstuPCB[iFnBuscaPosicionProc(pstuPCB[ulProcActual].ulId)].stuEsperaMemoria.liTamanio = liTamanioSolicitado;
     pstuPCB[iFnBuscaPosicionProc(pstuPCB[ulProcActual].ulId)].iEstado = 2;
       return 1;
    }





  uiOffset = 0;

  ucpFnCopiarMemoria((unsigned char*)pstuPCB[iFnBuscaPosicionProc(pstuPCB[ulProcActual].ulId)].uiDirBase + 0x9000 - iEnvpSize ,(unsigned char*)stEnvpTemp, iEnvpSize);
  uiOffset = uiOffset + iEnvpSize;




     uiOffset = uiOffset + sizeof(int);



    for( i = iEnvpSize -1 ; i > 0; i--)
   {
      if(stEnvpTemp[i] == '\0')
     {
     uiOffset = uiOffset + sizeof(int);
     *(int*)(pstuPCB[iFnBuscaPosicionProc(pstuPCB[ulProcActual].ulId)].uiDirBase + 0x9000 - uiOffset ) = 0x9000 - iEnvpSize + i +1 ;
     }
   }

  uiOffset = uiOffset + sizeof(int);
     piVectorEnviroment = 0x9000 - uiOffset;
  *(int*)(pstuPCB[iFnBuscaPosicionProc(pstuPCB[ulProcActual].ulId)].uiDirBase + 0x9000 - uiOffset) = 0x9000 - iEnvpSize;



  uiOffsetTemp = uiOffset;
  ucpFnCopiarMemoria((unsigned char*)pstuPCB[iFnBuscaPosicionProc(pstuPCB[ulProcActual].ulId)].uiDirBase + 0x9000 - uiOffsetTemp - iArgvSize ,(unsigned char*)stArgvTemp, iArgvSize);
  uiOffset = uiOffset + iArgvSize;




     uiOffset = uiOffset + sizeof(int);
  *(int*)(pstuPCB[iFnBuscaPosicionProc(pstuPCB[ulProcActual].ulId)].uiDirBase + 0x9000 - uiOffset ) = 0 ;


    for( i = iArgvSize -1 ; i > 0; i--)
   {
      if(stArgvTemp[i] == '\0')
     {
     uiOffset = uiOffset + sizeof(int);
     *(int*)(pstuPCB[iFnBuscaPosicionProc(pstuPCB[ulProcActual].ulId)].uiDirBase + 0x9000 - uiOffset ) = 0x9000 - uiOffsetTemp - iArgvSize + i +1 ;
     }
   }

  uiOffset = uiOffset + sizeof(int);
     piVectorArgv = 0x9000 - uiOffset;
  *(int*)(pstuPCB[iFnBuscaPosicionProc(pstuPCB[ulProcActual].ulId)].uiDirBase + 0x9000 - uiOffset) = 0x9000 - uiOffsetTemp - iArgvSize;


  uiOffset = uiOffset + sizeof(char**);
  *(int*)(pstuPCB[iFnBuscaPosicionProc(pstuPCB[ulProcActual].ulId)].uiDirBase + 0x9000 - uiOffset) = piVectorEnviroment;


  uiOffset = uiOffset + sizeof(char**);
  *(int*)(pstuPCB[iFnBuscaPosicionProc(pstuPCB[ulProcActual].ulId)].uiDirBase + 0x9000 - uiOffset) = piVectorArgv;


  uiOffset = uiOffset + sizeof(int);
  *(int*)(pstuPCB[iFnBuscaPosicionProc(pstuPCB[ulProcActual].ulId)].uiDirBase + 0x9000 - uiOffset) = iArgc;

  *(int*)(pstuPCB[iFnBuscaPosicionProc(pstuPCB[ulProcActual].ulId)].uiDirBase + 0x9000 - iEnvpSize - 2*sizeof(int)) = 0 ;


  vFnKFree(stEnvpTemp);
  vFnKFree(pstEnvpPointers);
  vFnKFree(stArgvTemp);
  vFnKFree(pstArgvPointers);


  iFnCopiaCadena(pstuPCB[iFnBuscaPosicionProc(pstuPCB[ulProcActual].ulId)].stNombre, strNombreArchivo);
 return iReturnCode;
}






long lFnSysTime(long *lT)
{
 long lTime = 17;


 vFnImprimir
     ("\n time(): el proceso actual %d usa DS=%x guardamos %d en %x",
      ulProcActual, stuTSSTablaTareas[ulProcActual].ds, lTime, lT);

 __asm__ volatile ( "pushl	%%ds		\n\t" "movl	%0, %%ds	\n\t" "movl	%2, (%1)	\n\t" "popl	%%ds		\n\t" :: "a"( stuTSSTablaTareas[ulProcActual].ds ), "b"( lT ), "c"( lTime ) );

 return lTime;
}






long lFnSysGetPid()
{

 return pstuPCB[ulProcActual].ulId;
}
# 563 "syscall.c"
long lFnSysKill(int pid, int sig)
{
 int iPosicionPCB = iFnBuscaPosicionProc(pid), iPCBPadre = 0;



 if (iPosicionPCB < 0
     || pstuPCB[iPosicionPCB].iEstado == 5) {
  return -9;
 }

 switch (sig) {
    case (8):

        vFnImprimir(
            "\nSe recibio SIGFPE (Error en operacion de punto flotante)");
        goto eliminarproceso;
 case (11):
        vFnImprimir("\nSe recibio SIGSEGV en el Proceso PID=%d \"%s\" ",
                pstuPCB[iPosicionPCB].ulId, pstuPCB[iPosicionPCB].stNombre);
        goto eliminarproceso;
 case (2):
 case (15):
 case (9):
eliminarproceso:

  iPCBPadre =
      iFnBuscaPosicionProc(pstuPCB[iPosicionPCB].ulParentId);




  pstuPCB[iPosicionPCB].iEstado = 5;
  pstuPCB[iPosicionPCB].iExitStatus = -1;

  if (pstuPCB[iPCBPadre].iEstado == 2) {
   pstuPCB[iPCBPadre].iEstado = 1;
  }
  break;
 case (19):
  if (pstuPCB[iPosicionPCB].iEstado == 1 ||
      pstuPCB[iPosicionPCB].iEstado == 0) {
   vFnImprimir
       ("\n pasando el proceso %d (en estado %d) a estado DETENIDO ",
        pid, pstuPCB[iPosicionPCB].iEstado);
   pstuPCB[iPosicionPCB].iEstado = 3;
  }
  break;
 case (18):
  if (pstuPCB[iPosicionPCB].iEstado == 3)
   pstuPCB[iPosicionPCB].iEstado = 1;
  break;
 default:
  return -3;
 }

 return 0;
}
# 629 "syscall.c"
long lFnSysGetPPid()
{
 return pstuPCB[ulProcActual].ulParentId;
}






long lFnSysReboot(int flag)
{
 outb(0xfe, 0x64);
 return -2;
}
# 654 "syscall.c"
long lFnSysSodiumCallgate(int iOpcion, int iPar1, int iPar2)
{
        if(iOpcion == 1) vFnCambiarTerminal();
        if(iOpcion == 2) vFnSysSetearColor(iPar1, iPar2);
        if(iOpcion == 3) vFnMenuCls();
        if(iOpcion == 4) vFnMenuGdt(iPar1);
        if(iOpcion == 6) vFnMenuVerSemaforos();
        if(iOpcion == 5) vFnMenuVerShm();
        if(iOpcion == 7) vFnImprimir("\nel syscall getpid() me devolvio %d", lFnSysGetPid());
        if(iOpcion == 8) vFnImprimir("\nel syscall getppid() me devolvio %d", lFnSysGetPPid());
        if(iOpcion == 9) lFnSysReboot(0);
        if(iOpcion == 10) vFnMenuPs();
        if(iOpcion == 12) vFnMenuMem();
        if(iOpcion == 11) vFnMenuSegs();
 if(iOpcion == 13) vFnImprimirMapaBits();
 if(iOpcion == 14) vFnMenuIdt(iPar1);
 if(iOpcion == 15) lFnSysSchedYield();
 if(iOpcion == 16) vFnMenuPag(iPar1);
 if(iOpcion == 17) vFnMenuTSS(iPar1);
 if(iOpcion == 18) vFnMenuStack(iPar1,iPar2);
 if(iOpcion == 19) vFnMenuExec(iPar1,iPar2);
 if(iOpcion == 20) if(iPar2==5) vFnMenuPlanif(pstuPCB[iFnBuscaPosicionProc(ulProcActual)].uiDirBase+iPar1,iPar2);
         else vFnMenuPlanif(iPar1,iPar2);


 if(iOpcion == 22) vFnMenuLeerArch(pstuPCB[iFnBuscaPosicionProc(ulProcActual)].uiDirBase+iPar1);
 if(iOpcion == 23) vFnMenuDump(iPar1,iPar2);
 if(iOpcion == 25) vFnMenuCD(pstuPCB[iFnBuscaPosicionProc(ulProcActual)].uiDirBase+iPar1);
 if(iOpcion == 26) vFnMenuLs(pstuPCB[iFnBuscaPosicionProc(ulProcActual)].uiDirBase+iPar1);
 if(iOpcion == 27) vFnMenuRm(pstuPCB[iFnBuscaPosicionProc(ulProcActual)].uiDirBase+iPar1);
 if(iOpcion == 28) vFnMenuWriteArch(pstuPCB[iFnBuscaPosicionProc(ulProcActual)].uiDirBase+iPar1,pstuPCB[iFnBuscaPosicionProc(ulProcActual)].uiDirBase+iPar2);
 if(iOpcion == 24) vFnMenuOptKill(iPar1);
 if(iOpcion == 21) return lFnSysKill(iPar1, iPar2);



 if(iOpcion == 29) {if (uiModoMemoria == 1) vFnMenuCheck(iPar1);
                                     else vFnImprimir("\nError: Comando no aplicable.");}
        if(iOpcion == 30) vFnEsperarPID(iPar1);
        if(iOpcion == 31) {int *iP;
                                     iP=pstuPCB[iFnBuscaPosicionProc(ulProcActual)].uiDirBase+iPar2;
                                     vFnMenuLotes(pstuPCB[iFnBuscaPosicionProc(ulProcActual)].uiDirBase+iPar1, pstuPCB[iFnBuscaPosicionProc(ulProcActual)].uiDirBase+iP[0], pstuPCB[iFnBuscaPosicionProc(ulProcActual)].uiDirBase+iP[1]);
                                     }
        if(iOpcion == 32) vFnMenuPCB(iPar1);
        if(iOpcion == 34) vFnMenuDesc(pstuPCB[iFnBuscaPosicionProc(ulProcActual)].uiDirBase+iPar1,iPar2);
        if(iOpcion == 35) vFnMenuEjecutar(pstuPCB[iFnBuscaPosicionProc(ulProcActual)].uiDirBase+iPar1);
        if(iOpcion == 36) vFnMenuFd();
        if(iOpcion == 37) vFnMenuSumaFpu(pstuPCB[iFnBuscaPosicionProc(ulProcActual)].uiDirBase+iPar1, pstuPCB[iFnBuscaPosicionProc(ulProcActual)].uiDirBase+iPar2);
        if(iOpcion == 38) vFnMenuVer();
        if(iOpcion == 39) {vFnCambiarVisibilidadVentanaProceso(); vFnImprimirContexto();}

 if(iOpcion == 40) {vFnImprimir("\nparece ser el intervalo");
     int lAux=lFnSysSchedRrGetInterval( 0,0);
     vFnImprimir("\nTime slice: %d",lAux);}
 if(iOpcion == 41) vFnMenuCambiaTeclado(iPar1);
 if(iOpcion == 46) vFnTermLog(iPar1);
 if(iOpcion == 47) vFnMostrarListaParticiones();
 if(iOpcion == 48) vFnMostrarTamaniosParticion();
        if(iOpcion == 49) vFnBorrarUltimaPartFija();
        if(iOpcion == 50) vFnAgregarPartFija(pstuPCB[iFnBuscaPosicionProc(ulProcActual)].uiDirBase+iPar1);
        if(iOpcion == 52) vFnRecorrerListaEspera();
        if(iOpcion == 53) vFnResetearListaPart();
  if(iOpcion == 51) uiTamHeap = iPar1;

 return 0;
}







int lFnSysPorcentaje(int ptrPorcentaje)
{
        int i;

        for(i = 0; i < 100; i++) ((t_Porcentaje*)(pstuPCB[ulProcActual].uiDirBase+ptrPorcentaje))->piPorcentajesPartFija[i] = piPorcentajesPartFija[i];
 return 0;
}
# 742 "syscall.c"
long lFnSysSBrk(unsigned long ulTamanioAdicional) {

   if(iModo == 0) return -1;
   long int liTam;
   liTam = pstuPCB[ulProcActual].uiTamProc;
   vFnLog("\nSBRK. Pid: %d. Tam Actual: 0x%x. Incremento Deseado: 0x%x",ulProcActual,liTam, liTam + ulTamanioAdicional);
   return iFnRedimensionarProceso(ulProcActual,liTam + ulTamanioAdicional);


}






long lFnSysBrk(unsigned long ulTamanioNuevo) {

   if(iModo == 0) return -1;
   long int liTam;
   liTam = pstuPCB[ulProcActual].uiTamProc;
   vFnLog("\nBRK. Pid: %d. Tam Actual: 0x%x. Tam Deseado: 0x%x",ulProcActual,liTam, liTam + ulTamanioNuevo);
   return iFnRedimensionarProceso(ulProcActual,ulTamanioNuevo);


}
# 779 "syscall.c"
long lFnSysSemInit( sem_t *sem, sem_init_params * params ){
 params = (sem_init_params *)(pstuPCB[ ulProcActual ].uiDirBase + (unsigned int)params);

 return iFnSemInit(sem, params->pshared, params->value);
}






long lFnSysSemPost( sem_t *sem ){
 return iFnSemPost(sem);
}






long lFnSysSemWait( sem_t *sem ){
 return iFnSemWait(sem);
}






long lFnSysSemClose( sem_t *sem ){
 return iFnSemClose(sem);
}






long lFnSysShmGet(key_t key, size_t size){
 return iFnShmGet(key, size);
}






long lFnSysShmAt( int shmid, void * shmAddr ){
 return iFnShmAt(shmid, shmAddr);
}






long lFnSysShmDt( key_t key ){
 return iFnShmDt( key );
}
# 848 "syscall.c"
int iFnSysSumar(int a, int b,int * res)
{

 __asm__ volatile ( "pushl	%%ds		\n\t" "movl	%0, %%ds	\n\t" "movl	%2, (%1)	\n\t" "popl	%%ds		\n\t" :: "a"( stuTSSTablaTareas[ ulProcActual ].ds ), "b"( res ), "c"( a+b ) );

 return *res;
}
# 866 "syscall.c"
long lFnSysNice(int iIncremento)
{
 long lNuevaPrio;


 lNuevaPrio = pstuPCB[ulProcActual].iPrioridad + iIncremento;

 if(lNuevaPrio < -20)
  lNuevaPrio = -20;

 if(lNuevaPrio > 19)
  lNuevaPrio = 19;


 pstuPCB[ulProcActual].iPrioridad = lNuevaPrio;

 return 0;

}
# 897 "syscall.c"
long lFnSysGetpriority(int which,int who)
{
 int iCont = 0;
 int iPrio;

 if(which > 2 || which < 0)
  return -3;

 if(which == 0)
 {
  if(who == 0)
  {
   iPrio = 20 - pstuPCB[ulProcActual].iPrioridad;
   return iPrio;
  }
  else
  {
   for(iCont = 0; iCont < 50;iCont++)
   {

    if(pstuPCB[iCont].ulId == who &&
    pstuPCB[iCont].iEstado != -1 &&
    pstuPCB[iCont].iEstado != 4)
    {
    iPrio = 20 - pstuPCB[iCont].iPrioridad;

    return iPrio;
    }
   }
  }
 }
 else
 {
 vFnImprimir("Prioridad de grupos y de usuarios en desarrollo\n");
 }


 return -9;
}






long lFnSysSetpriority(int which,int who,int iPrioridad)
{
 int iCont;

 if(which > 2 || which < 0)
  return -3;

 if(iPrioridad < -20)
  iPrioridad = -20;
 if(iPrioridad > 19)
  iPrioridad = 19;

 if(which == 0)
 {
  if(who == 0)
  {
  pstuPCB[ulProcActual].iPrioridad = iPrioridad;
  return 0;
  }
  else
  {
   for(iCont = 0; iCont < 50;iCont++)
   {

    if(pstuPCB[iCont].ulId == who &&
    pstuPCB[iCont].iEstado != -1 &&
    pstuPCB[iCont].iEstado != 4)
    {
     pstuPCB[iCont].iPrioridad = iPrioridad;

    return 0;
    }
   }
  }
 }
 else
 {
 vFnImprimir("Prioridad de grupos y de usuarios en desarrollo\n");
 }

 return -9;
}






long lFnSysClone(stuRegs * regs,int flags)
{
 return -1;
}
# 1003 "syscall.c"
unsigned uiFnPasarBCD(int iValor){
 unsigned iValorAlto, iValorBajo;
 iValorAlto = iValor /10;
 iValorBajo = iValor - (iValorAlto * 10);
 iValorAlto <<= 4;
 return (iValorAlto |= iValorBajo);
}






long lFnSysSettime(timeval tp){

 int iFecha[6];
 int iAnioActual = 2000;
 int iCantidadDiasAnio = 366;



 int iSecuenciaAnioBisiesto[13] = {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366};
 int iSecuenciaAnioNoBisiesto[13] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365};
 int i;



 long liTiempo = tp.tv_sec;
 int iCantidadDiasTranscurridos = liTiempo/86400;


 liTiempo -= iCantidadDiasTranscurridos*86400;


 while(iCantidadDiasTranscurridos >= iCantidadDiasAnio)
 {
  iCantidadDiasTranscurridos -= iCantidadDiasAnio;

  iAnioActual ++;
  if (((iAnioActual % 4 == 0) && ((iAnioActual % 100 != 0) || (iAnioActual % 400 == 0))) == 1)
   iCantidadDiasAnio = 366;
  else
   iCantidadDiasAnio = 365;
 }


 if (((iAnioActual % 4 == 0) && ((iAnioActual % 100 != 0) || (iAnioActual % 400 == 0))) == 1){
  for(i = 0; iCantidadDiasTranscurridos >= iSecuenciaAnioBisiesto[i]; i++);
 }

 else{
  for(i = 0; iCantidadDiasTranscurridos >= iSecuenciaAnioNoBisiesto[i]; i++);
 }

 if (((iAnioActual % 4 == 0) && ((iAnioActual % 100 != 0) || (iAnioActual %400 == 0))) == 1) {
  iCantidadDiasTranscurridos -= iSecuenciaAnioBisiesto[i-1];
 }

 else{
  iCantidadDiasTranscurridos -= iSecuenciaAnioNoBisiesto[i-1];
 }




 iFecha[0] = iAnioActual - 2000;


 iFecha[1] = i;
 iFecha[2] = iCantidadDiasTranscurridos + 1;


 iFecha[3] = liTiempo / 3600;
 liTiempo -= iFecha[3] * 3600;


 iFecha[4] = liTiempo / 60;
 liTiempo-=iFecha[4] * 60;


 iFecha[5] = liTiempo;

 outb(9, 0x70);
 outb(uiFnPasarBCD(iFecha[0]), 0x71);
 outb(8, 0x70);
 outb(uiFnPasarBCD(iFecha[1]), 0x71);
 outb(7, 0x70);
 outb(uiFnPasarBCD(iFecha[2]), 0x71);
 outb(4, 0x70);
 outb(uiFnPasarBCD(iFecha[3]), 0x71);
 outb(2, 0x70);
 outb(uiFnPasarBCD(iFecha[4]), 0x71);
 outb(0, 0x70);
 outb(uiFnPasarBCD(iFecha[5]), 0x71);


 ulTiempo = tp.tv_sec * 1000 + tp.tv_usec;

 return 0;
}






long lFnSysStime(time_t *newtime){

 timeval timervalTime;
 long lRetorno;

 time_t *tiempo = (time_t *)(pstuPCB[ ulProcActual ].uiDirBase + (unsigned int)newtime);
 timervalTime.tv_sec = *tiempo;
 timervalTime.tv_usec = 0;

 lRetorno = lFnSysSettime(timervalTime);
 return lRetorno;
}






long lFnSysTimes(tms *tmsBuffer){
 tms *tmsTiempos = (tms *)(pstuPCB[ ulProcActual ].uiDirBase + (unsigned int)tmsBuffer);
 tms tmsTiemposReales = pstuPCB[ ulProcActual ].stuTmsTiemposProceso;
 tmsTiempos->tms_utime = tmsTiemposReales.tms_utime / 2;
 tmsTiempos->tms_stime = tmsTiemposReales.tms_stime / 2;
 tmsTiempos->tms_cutime = tmsTiemposReales.tms_cutime / 2;
 tmsTiempos->tms_cstime = tmsTiemposReales.tms_cstime / 2;
 return uliClockTick;
}






long lFnSysGettimeofday(timeval *timervalTp, timezone *timezoneTzp){
 timeval *timevalTime = (timeval *)(pstuPCB[ ulProcActual ].uiDirBase + (unsigned int)timervalTp);
 timezone *timezoneZona = (timezone *)(pstuPCB[ ulProcActual ].uiDirBase + (unsigned int)timezoneTzp);

 unsigned long ulMilisegundos = ulTiempo;
 timevalTime->tv_sec = ulMilisegundos/1000;
 timevalTime->tv_usec = ulMilisegundos - (timevalTime->tv_sec*1000);
 timevalTime->tv_sec += (iMinuteswest*60);
 timezoneZona->tz_minuteswest = iMinuteswest;
 timezoneZona->tz_dsttime = 0;
 return 0;
}







long lFnSysGettimer(int iWhich, itimerval *itimervalValue){
 itimerval *itimervalTimer;

 if (iWhich != 0 && iWhich != 1 && iWhich != 2)
  return -3;

 itimervalTimer = (itimerval *)(pstuPCB[ ulProcActual ].uiDirBase + (unsigned int) itimervalValue);
 itimervalTimer->it_interval = pstuPCB[ ulProcActual ].timers[iWhich].it_interval;
 itimervalTimer->it_value = pstuPCB[ ulProcActual ].timers[iWhich].it_value;
 return 0;
}






long lFnSysSettimeofday(timeval *timevalTp, timezone *timezoneTzp){
 timeval timevalTime = *(timeval *)(pstuPCB[ ulProcActual ].uiDirBase + (unsigned int)timevalTp);
 timezone timezoneZona = *(timezone *)(pstuPCB[ ulProcActual ].uiDirBase + (unsigned int)timezoneTzp);

 iMinuteswest = timezoneZona.tz_minuteswest;
 return lFnSysSettime(timevalTime);
}






long lFnSysSettimer(int which, itimerval const *value, itimerval *ovalue){
 itimerval *timerViejo;
 itimerval *timer;
 if (which != 0 && which != 1 && which != 2){
  return -3;
 }

 timerViejo = (itimerval *)(pstuPCB[ ulProcActual ].uiDirBase + (unsigned int) ovalue);
 timer = (itimerval *)(pstuPCB[ ulProcActual ].uiDirBase + (unsigned int) value);
 timerViejo->it_interval = pstuPCB[ ulProcActual ].timers[which].it_interval;
 timerViejo->it_value = pstuPCB[ ulProcActual ].timers[which].it_value;
 pstuPCB[ ulProcActual ].timers[which].it_value = timer->it_value;
 pstuPCB[ ulProcActual ].timers[which].it_interval = timer->it_interval;
 return 0;
}






long lFnSysAdjtimex(timex *timexBuffer){
 timex *timexTimeVars;
 int modo, iNewFreq;

 timexTimeVars = (timex *)(pstuPCB[ ulProcActual ].uiDirBase + (unsigned int) timexBuffer);
 modo = timexTimeVars->modes;

 if (modo){
  if (modo & 0X0010){
   return -3;

  }
  if (modo & 0X0002){
   return -3;

  }
  if (modo & 0X0004){
   return -3;

  }
  if (modo & 0X0008){
   return -3;

  }
  if (modo & 0X0020){
   return -3;

  }
  if (modo & 0X0001){
   return -3;


  }
  if (modo & 0X4000){
   if (timexTimeVars->tick < 1)
    return -3;
   iNewFreq = (timexTimeVars->tick * 1193181l) / 1000;
   vFnImprimir("\nDivisor = %d", iNewFreq);
   vFnIniciarTimer_Asm(iNewFreq);
   iMilisegundosPorTick = timexTimeVars->tick;
   lRelojMaxerror = (((1000000 * iNewFreq) / 1193181l) - (iMilisegundosPorTick * 1000) * (0x10000-1)) / 1000;
  }
 }

 timexTimeVars->offset = lRelojOffset;
 timexTimeVars->freq = lRelojFrequencia;
 timexTimeVars->maxerror = lRelojMaxerror;
 timexTimeVars->esterror = lRelojEsterror;
 timexTimeVars->constant = lRelojConstante;
 timexTimeVars->precision = 1;
 timexTimeVars->time.tv_sec = ulTiempo / 1000;
 timexTimeVars->time.tv_usec = ulTiempo - (timexTimeVars->time.tv_sec * 1000);
 timexTimeVars->tick = iMilisegundosPorTick;

 return iRelojEstado;
}






long lFnSysNanosleep(timespec const *timespecRequested_time, timespec *timespecRemaining){
 timespec timespecTiempoRequerido;

 timespecTiempoRequerido = *(timespec *)(pstuPCB[ ulProcActual ].uiDirBase + (unsigned int) timespecRequested_time);

 if (timespecTiempoRequerido.tv_sec < 0 || timespecTiempoRequerido.tv_nsec < 0 || timespecTiempoRequerido.tv_nsec > 999999999)
  return -3;
 pstuPCB[ ulProcActual ].iEstado = 3;
 timespecTiempoRequerido.tv_nsec/= 1000000;
 pstuPCB[ ulProcActual ].lNanosleep = (timespecTiempoRequerido.tv_sec * 1000) + timespecTiempoRequerido.tv_nsec;
 pstuPCB[ ulProcActual ].puRestoDelNanosleep = timespecRemaining;
 vFnPlanificador();
 return 0;
}
# 1296 "syscall.c"
long lFnSysIdle()
{
  unsigned int uiVectorDescriptorAuxiliarTarea[2];

  vFnImprimirOk(55);




  if (pstuPCB[staiN].iEstado != 4
    && pstuPCB[staiN].iEstado != 5
    && pstuPCB[staiN].iEstado != 2
    && pstuPCB[staiN].iEstado != 3)
  pstuPCB[staiN].iEstado = 1;

    pstuPCB[iTareaNula].iEstado = 0;

      staiProcesoAnterior = staiN;
       ulProcActual = iTareaNula;






       uiVectorDescriptorAuxiliarTarea[1] = pstuPCB[iTareaNula].uiIndiceGDT_TSS * 8;




     asm ("clts\t\n" "ljmp *%0": :"m" (*uiVectorDescriptorAuxiliarTarea));

 return 0;
}






long lFnSysSchedSetParam(int p)
{
    if(lFnSysSchedGetScheduler()==0){
 }
 if(lFnSysSchedGetScheduler()==2){
  uliBTSQ = p;
 }
 if(lFnSysSchedGetScheduler()==1){
  uliQuantum = p;
 }

 return lFnSysSchedSetScheduler(p);
}






long lFnSysSchedSetScheduler(int p)
{
    if(p==0)
    {
     bPlanificador=0;
       return 0;
    }
    if(p==1)
    {
       uliQuantum=1;
    bPlanificador=1;
       return 1;
    }
    if(p==2)
    {
       uliQuantum=2;
       bPlanificador=2;
       return 2;
    }
    return -1;
}






long lFnSysSchedGetParam()
{
    if(bPlanificador==1){
       return uliQuantum;
    }
    if(bPlanificador==0){
       return -1;
    }
 if(bPlanificador==2){
    return uliBTSQ;
 }

 return -1;
}







long lFnSysSchedGetScheduler()
{
 return bPlanificador;
}






long lFnSysSchedYield()
{


 vFnPlanificador();
 return 0;
}






long lFnSysSchedGetPriorityMax()
{
    if(bPlanificador==2){
  return 1;
 }
 return -1;
}






long lFnSysSchedGetPriorityMin()
{
    if(bPlanificador==2){
  return 50;
 }
 return -1;
}






long lFnSysSchedRrGetInterval()
{
    return uliTimeSlice;
}







long lFnSysPtrace( int iRequest, void *pvDirParam ) {

 __ptrace_param *pstuParam;


 stuRegs* pstuTss;

 stuFpu* pstuFpu;


 pvDirParam = (void *)(pstuPCB[ ulProcActual ].uiDirBase + (unsigned int)pvDirParam );
 pstuParam = (__ptrace_param *)pvDirParam;

 if ( iFnBuscaPosicionProc(pstuParam->iPid) < 0 || pstuPCB[ iFnBuscaPosicionProc(pstuParam->iPid) ].iEstado == 5 ){
  return -9;
 }


 if ( (iRequest != PTRACE_ATTACH) && (iRequest != PTRACE_TRACEME) )
 {
  if ( (pstuPCB[iFnBuscaPosicionProc(pstuParam->iPid)].lPidTracer == -1) || (pstuPCB[iFnBuscaPosicionProc(pstuParam->iPid)].lPidTracer != pstuPCB[ulProcActual].ulId) )
  {
   return -8;
  }
 }

 switch ( iRequest ) {
  case( PTRACE_TRACEME ):

   if (pstuPCB[ ulProcActual ].lPidTracer == -1)
    pstuPCB[ulProcActual].lPidTracer = pstuPCB[ulProcActual].ulParentId;
   else
    return -8;
   break;
  case( PTRACE_PEEKTEXT ):
   pstuParam->pvData = (void*)(*(int*)( pstuPCB[ iFnBuscaPosicionProc(pstuParam->iPid) ].uiDirBase + (unsigned)pstuParam->pvAddr) );
   break;
  case( PTRACE_PEEKDATA ):
   pstuParam->pvData = (void*)(*(int*)( pstuPCB[ iFnBuscaPosicionProc(pstuParam->iPid) ].uiDirBase + (unsigned)pstuParam->pvAddr) );
   break;
  case( PTRACE_PEEKUSER ):
   pstuParam->pvData = (void*)(*(int*)( pstuPCB[ iFnBuscaPosicionProc(pstuParam->iPid) ].uiDirBase + (unsigned)pstuParam->pvAddr) );
   break;
  case( PTRACE_POKETEXT ):
   *(int*)( pstuPCB[ iFnBuscaPosicionProc(pstuParam->iPid) ].uiDirBase + (unsigned)pstuParam->pvAddr ) = (int)pstuParam->pvData;
   break;
  case( PTRACE_POKEDATA ):
   *(int*)( pstuPCB[ iFnBuscaPosicionProc(pstuParam->iPid) ].uiDirBase + (unsigned)pstuParam->pvAddr ) = (int)pstuParam->pvData;
   break;
  case( PTRACE_POKEUSER ):
   *(int*)( pstuPCB[ iFnBuscaPosicionProc(pstuParam->iPid) ].uiDirBase + (unsigned)pstuParam->pvAddr ) = (int)pstuParam->pvData;
   break;
  case( PTRACE_GETREGS ):
   pstuTss = (stuRegs*)(pstuPCB[ ulProcActual ].uiDirBase + (unsigned int)pstuParam->pvData );
   pstuTss->eax = stuTSSTablaTareas[ iFnBuscaPosicionProc(pstuParam->iPid) ].eax;
   pstuTss->ebx = stuTSSTablaTareas[ iFnBuscaPosicionProc(pstuParam->iPid) ].ebx;
   pstuTss->ecx = stuTSSTablaTareas[ iFnBuscaPosicionProc(pstuParam->iPid) ].ecx;
   pstuTss->edx = stuTSSTablaTareas[ iFnBuscaPosicionProc(pstuParam->iPid) ].edx;
   break;
  case( PTRACE_GETFPREGS ):




   pstuFpu = (stuFpu*)(pstuPCB[ ulProcActual ].uiDirBase + (unsigned int)pstuParam->pvData );




   if( ulUltimoProcesoEnFPU == pstuParam->iPid ) {

     asm volatile(
       "fnsave %0\n"
       "fwait	\n"
       "frstor %0\n"
       : "=m" (*pstuFpu));
   } else {


    ucpFnCopiarMemoria( (unsigned char*) pstuFpu,
         (unsigned char*) &stuTSSTablaTareas[iFnBuscaPosicionProc(pstuParam->iPid)].fpu,
         sizeof(stuFpu));
   }
   break;
  case( PTRACE_SETREGS ):
   pstuTss = (stuRegs*)(pstuPCB[ ulProcActual ].uiDirBase + (unsigned int)pstuParam->pvData );
   stuTSSTablaTareas[ iFnBuscaPosicionProc(pstuParam->iPid) ].eax = pstuTss->eax;
   stuTSSTablaTareas[ iFnBuscaPosicionProc(pstuParam->iPid) ].ebx = pstuTss->ebx;
   stuTSSTablaTareas[ iFnBuscaPosicionProc(pstuParam->iPid) ].ecx = pstuTss->ecx;
   stuTSSTablaTareas[ iFnBuscaPosicionProc(pstuParam->iPid) ].edx = pstuTss->edx;
   break;
  case( PTRACE_SETFPREGS ):




   pstuFpu = (stuFpu*)(pstuPCB[ ulProcActual ].uiDirBase + (unsigned int)pstuParam->pvData );


   ucpFnCopiarMemoria( (unsigned char*) &stuTSSTablaTareas[iFnBuscaPosicionProc(pstuParam->iPid)].fpu,
        (unsigned char*) pstuFpu,
        sizeof(stuFpu));




   if( ulUltimoProcesoEnFPU == pstuParam->iPid ) {
    ulUltimoProcesoEnFPU = 0;
   }

   break;
  case( PTRACE_CONT ):
   return lFnSysKill( pstuParam->iPid, 18);
   break;
  case( PTRACE_KILL ):
   return lFnSysKill( pstuParam->iPid, 9);
   break;
  case( PTRACE_ATTACH ):
   if ( pstuPCB[ iFnBuscaPosicionProc( pstuParam->iPid ) ].lPidTracer == -1 )
     pstuPCB[iFnBuscaPosicionProc(pstuParam->iPid)].lPidTracer = pstuPCB[ulProcActual].ulId;
   else
    return -8;
   break;
  case( PTRACE_DETACH ):

   pstuPCB[iFnBuscaPosicionProc(pstuParam->iPid)].lPidTracer = -1;
   break;
  default:
   return -3;
 }

 return 0l;
}
# 1604 "syscall.c"
void vFnEsperarPID(int iArgumento)
{
int ret = 0, status = 0, pid = 0;

if (iArgumento >= 0)
 {
 ret = lFnSysWaitPid(iArgumento, &status, 0);
 vFnImprimir("\nel syscall waitpid() me devolvio %d, y estado quedo en %d", ret, status);
 }
else
 vFnImprimir("\nPID invalido.");
}
